package opera;

import book.Book;
import book.BookList;

public class ShowOperation implements IOperation{
    @Override
    public void work(BookList booklist) {
        System.out.println("显示图书！");
        int currentSize = booklist.getUsedSize();
        //通过currentSize变量来记录传过来的usedSize,
        //通过for循环将books数组中的所有元素遍历输出
        for (int i = 0; i < currentSize; i++) {
            //通过booklist调用BookList中的getBook方法，得到下标为i的books数组中的元素
           Book book = booklist.getBook(i);
          //输出这本书
            System.out.println(book);
        }
    }
}
